package com.woniuxy.Filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @Author：向天浩
 * @Date：2022/2/15 13:06
 * @Description :TODO
 */

public class FilterTwo implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        //获取开始时间
        long startTime = System.currentTimeMillis();
        //进入过滤器的时间
        System.out.println("进入过滤器2的时间;"+startTime+"ms");
        chain.doFilter(request, response);
        System.out.println("流程结束返回到过滤器2的时间;"+(System.currentTimeMillis() - startTime)+"ms");

    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
